<template>
     <div>
        <div class="header">
            <input type="text" v-model="newMsg">
            <button @click="add">确定</button>
        </div>
    </div>
</template>

<script setup>
import { computed, ref, watch, onBeforeUpdate, onUpdated } from 'vue'
const newMsg = ref('')

const emits = defineEmits(['addMsg'])   // 定义
const add = () =>{
    emits('addMsg',newMsg.value)  // 发布
}
</script>

<style lang="css" scoped>

</style>